﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace test.Models
{
    public partial class hongjiContext : DbContext
    {
        public hongjiContext()
        {
        }


        public hongjiContext(DbContextOptions<hongjiContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Columnmanage> Columnmanages { get; set; } = null!;
        public virtual DbSet<Commontable> Commontables { get; set; } = null!;
        public virtual DbSet<Flink> Flinks { get; set; } = null!;
        public virtual DbSet<Jsonfile> Jsonfiles { get; set; } = null!;
        public virtual DbSet<Message> Messages { get; set; } = null!;
        public virtual DbSet<Page> Pages { get; set; } = null!;
        public virtual DbSet<Setting> Settings { get; set; } = null!;
        public virtual DbSet<User> Users { get; set; } = null!;

        /*protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
        }*/



        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.UseCollation("utf8_general_ci")
                .HasCharSet("utf8");

            modelBuilder.Entity<Columnmanage>(entity =>
            {
                entity.ToTable("columnmanage");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.ColumnId).HasColumnName("ColumnID");

                entity.Property(e => e.ColumnName).HasMaxLength(100);

                entity.Property(e => e.ColumnStep).HasDefaultValueSql("'1'");

                entity.Property(e => e.Content).HasMaxLength(100);

                entity.Property(e => e.Description).HasColumnType("text");

                entity.Property(e => e.ImgUrl)
                    .HasMaxLength(100)
                    .HasColumnName("Img_url");

                entity.Property(e => e.SubColumnName).HasMaxLength(100);
            });

            modelBuilder.Entity<Commontable>(entity =>
            {
                entity.ToTable("commontable");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.AddTime).HasColumnType("datetime");

                entity.Property(e => e.ColumnId)
                    .HasColumnName("ColumnID")
                    .HasDefaultValueSql("'1'");

                entity.Property(e => e.Content).HasColumnType("text");

                entity.Property(e => e.ContentJson).HasColumnType("text");

                entity.Property(e => e.Deleted).HasDefaultValueSql("'0'");

                entity.Property(e => e.Description).HasMaxLength(500);

                entity.Property(e => e.Flag).HasDefaultValueSql("'1'");

                entity.Property(e => e.ImgJson).HasMaxLength(100);

                entity.Property(e => e.ImgUrl)
                    .HasMaxLength(100)
                    .HasColumnName("Img_url");

                entity.Property(e => e.Model).HasMaxLength(100);

                entity.Property(e => e.ParameterJson).HasMaxLength(100);

                entity.Property(e => e.Reading).HasDefaultValueSql("'0'");

                entity.Property(e => e.Sorts).HasDefaultValueSql("'0'");

                entity.Property(e => e.SubTopic).HasMaxLength(100);

                entity.Property(e => e.Topic).HasMaxLength(100);

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .ValueGeneratedOnAddOrUpdate();
            });

            modelBuilder.Entity<Flink>(entity =>
            {
                entity.ToTable("flink");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.Item).HasMaxLength(50);

                entity.Property(e => e.Url)
                    .HasMaxLength(100)
                    .HasColumnName("URL");
            });

            modelBuilder.Entity<Jsonfile>(entity =>
            {
                entity.ToTable("jsonfile");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.Flag).HasDefaultValueSql("'1'");

                entity.Property(e => e.JsonData).HasColumnType("json");
            });

            modelBuilder.Entity<Message>(entity =>
            {
                entity.ToTable("messages");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.AddTime).HasColumnType("datetime");

                entity.Property(e => e.Address).HasMaxLength(50);

                entity.Property(e => e.ColumnId)
                    .HasColumnName("ColumnID")
                    .HasDefaultValueSql("'1'");

                entity.Property(e => e.Company).HasMaxLength(255);

                entity.Property(e => e.ContactName).HasMaxLength(50);

                entity.Property(e => e.Content).HasColumnType("text");

                entity.Property(e => e.Email).HasMaxLength(50);

                entity.Property(e => e.Fax).HasMaxLength(50);

                entity.Property(e => e.Phone).HasMaxLength(50);

                entity.Property(e => e.Tel).HasMaxLength(50);

                entity.Property(e => e.Topic).HasMaxLength(50);
            });

            modelBuilder.Entity<Page>(entity =>
            {
                entity.ToTable("page");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.Content).HasColumnType("text");

                entity.Property(e => e.Description).HasMaxLength(500);

                entity.Property(e => e.ImgUrl)
                    .HasMaxLength(100)
                    .HasColumnName("Img_Url");

                entity.Property(e => e.SubTitle).HasMaxLength(50);

                entity.Property(e => e.Title).HasMaxLength(50);
            });

            modelBuilder.Entity<Setting>(entity =>
            {
                entity.ToTable("setting");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.Address).HasMaxLength(100);

                entity.Property(e => e.CompanyName).HasMaxLength(100);

                entity.Property(e => e.Description).HasMaxLength(500);

                entity.Property(e => e.Email).HasMaxLength(50);

                entity.Property(e => e.Fax).HasMaxLength(50);

                entity.Property(e => e.Keywords).HasMaxLength(100);

                entity.Property(e => e.Phone).HasMaxLength(50);

                entity.Property(e => e.Qq)
                    .HasMaxLength(50)
                    .HasColumnName("QQ");

                entity.Property(e => e.Seotitle)
                    .HasMaxLength(50)
                    .HasColumnName("SEOTitle");

                entity.Property(e => e.Tel).HasMaxLength(50);

                entity.Property(e => e.Title).HasMaxLength(50);

                entity.Property(e => e.Website).HasMaxLength(50);
            });

            modelBuilder.Entity<User>(entity =>
            {
                entity.ToTable("users");

                entity.HasCharSet("utf8mb4")
                    .UseCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.Locked).HasDefaultValueSql("'1'");

                entity.Property(e => e.LoginTime).HasColumnType("datetime");

                entity.Property(e => e.Nick).HasMaxLength(50);

                entity.Property(e => e.PassWord).HasMaxLength(50);

                entity.Property(e => e.Permissions).HasDefaultValueSql("'0'");

                entity.Property(e => e.UserName).HasMaxLength(50);
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
